< previous page page_535 next page >

Page 535
EXERCISE
Add a Command Object to the Data Environment
1. Add a new Command object to the connection you created earlier.
2. Set the Name property to cmdEmployees.
3. Click the Properties icon to bring up the Command objects properties.
4. Click the Database Object drop-down combo box and select Table.
5. Select the tblEmployees table from the Object Name drop-down combo box. Note that the Microsoft OLE DB provider for SQL Server may not allow you to access the Object Name combo box. This usually happens if youve installed a previous version of ADO and did not uninstall it prior to installing Visual Basic 6. You may have to type in the name of the table yourself. If this is the case, type in tblEmployees in this combo box.
6. Click the OK button to save this Command object.
7. You should now see a plus sign next to the Command object you created in the Data Environment window.
8. Click this plus sign to see a list of all the fields in this table.
analysis.gifYou now have created a command object that can be used as a data source to any data-aware control.

Setting Field Properties
After youve created the Command object, you can now set properties for each of the fields in it. If you set the Caption property in the Field Properties dialog box as shown in Figure 27.5, you can drag and drop the Command object onto a form and all the labels and text boxes will be automatically created, ready to be bound to the data environment.
8160-0535a.gif
Figure 27.5
The Field Properties dialog box.

 
< previous page page_535 next page >

If you like this book, buy it!